package com.example.myapplication.WebView;

import android.content.Context;
import android.util.Log;
import android.webkit.ValueCallback;
import android.webkit.WebView;


public class AndroidAppInterface {
    private static Context mContext;
    private static WebView mWebview;

    AndroidAppInterface(Context context, WebView mWebview) {
        mContext = context;
        mWebview = mWebview;
    }
    public static void sum1(Integer num,Integer num2){
        mWebview.evaluateJavascript("sum1(" + num + "," + num2 + ")", new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
                Log.d("TAG", "js返回的结果是=" + value);
            }
        });
    }

    public static void sum2(Integer num,Integer num2){
        mWebview.evaluateJavascript("sum2(" + num + "," + num2 + ")", new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
                Log.d("TAG", "js返回的结果是=" + value);
            }
        });
    }

    public static void sum3(Integer num,Integer num2){
        mWebview.evaluateJavascript("sum3(" + num + "," + num2 + ")", new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
                Log.d("TAG", "js返回的结果是=" + value);
            }
        });
    }

    public static void sum4(Integer num,Integer num2){
        mWebview.evaluateJavascript("sum4(" + num + "," + num2 + ")", new ValueCallback<String>() {
            @Override
            public void onReceiveValue(String value) {
                Log.d("TAG", "js返回的结果是=" + value);
            }
        });
    }
}
